﻿using System;


namespace Agile.Paypal
{
    /// <summary>
    /// Class Commerce
    /// </summary>
    public class Merchant
    {
  
        /// <summary>
        /// Gets or sets a value indicating whether [test enviroment].
        /// </summary>
        /// <value><c>true</c> if [test enviroment]; otherwise, <c>false</c>.</value>
        public bool TestEnviroment { get; set; }
        /// <summary>
        /// Gets or sets the merchant email.
        /// </summary>
        /// <value>The merchant email.</value>
        public string Email { get; set; }

        /// <summary>
        /// Occurs when [invalid notification received].
        /// </summary>
        public event Action<PaypalNotification> InvalidNotificationReceived;

        /// <summary>
        /// Occurs when [web accept received].
        /// </summary>
        public event Action<PaypalNotification> WebAcceptReceived;

        /// <summary>
        /// Occurs when [subscription payment received].
        /// </summary>
        public event Action<PaypalNotification> SubscriptionPaymentReceived;

        /// <summary>
        /// Raises the web accept received event.
        /// </summary>
        /// <param name="notification">The notification.</param>
        internal void RaiseWebAcceptReceived(PaypalNotification notification)
        {
            if (WebAcceptReceived != null)
                WebAcceptReceived(notification);
        }

        /// <summary>
        /// Raises the subscription payment received event.
        /// </summary>
        /// <param name="notification">The notification.</param>
        internal void RaiseSubscriptionPaymentReceived(PaypalNotification notification)
        {
            if (SubscriptionPaymentReceived != null)
                SubscriptionPaymentReceived(notification);
        }

        /// <summary>
        /// Raises the invalid notification received event.
        /// </summary>
        /// <param name="notification">The notification.</param>
        internal void RaiseInvalidNotificationReceived(PaypalNotification notification)
        {
            if (InvalidNotificationReceived != null)
                InvalidNotificationReceived(notification);
        }

        /// <summary>
        /// Raises the subscription sign up event.
        /// </summary>
        /// <param name="notification">The notification.</param>
        internal void RaiseSubscriptionSignUp(PaypalNotification notification)
        {
            if (SubscriptionSignUp != null)
                SubscriptionSignUp(notification);
        }

        /// <summary>
        /// Occurs when [subscription sign up].
        /// </summary>
        public event Action<PaypalNotification> SubscriptionSignUp;
    }
}
